cmake_minimum_required(VERSION 3.2)

PROJECT(luaredis)
INCLUDE(cmake/ModuleImport.cmake)
INCLUDE(cmake/LuaModule.cmake)
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
INCLUDE(cmake/ModuleCompileOptions.cmake)
ModuleSetCompileOptions()
ModuleSetWinCompilerFlags()

SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)

SET(LUA_MODULE lua53)
SET(LUAREDIS_VERSION_MAJOR "1")
SET(LUAREDIS_VERSION_MINOR "0")
SET(LUAREDIS_VERSION_PATCH "1")
SET(LUAREDIS_VERSION "${LUAREDIS_VERSION_MAJOR}.${LUAREDIS_VERSION_MINOR}.${LUAREDIS_VERSION_PATCH}")

MESSAGE(STATUS "VERSION: ${LUAREDIS_VERSION}")

LibImport("hiredis" "src/hiredis")

ADD_DEFINITIONS(-DUSE_LUAREDIS -D_FILE_OFFSET_BITS=64)
ADD_DEFINITIONS(-DLUA_COMPAT_MODULE -DLUA_COMPAT_APIINTCASTS)


LuaModuleImport("${LUA_MODULE}" "luaredis" "src/luaredis" "hiredis")

